input {
  beats {
     port => 5044
  }
}

filter {

}

output {
    if [app] == "www" {
        if [type] == "nginx-access" {
           elasticsearch {
              hosts => {{elk.logstash.logstash_to_es_hosts}}
              index => "{{elk.logstash.index.nginx_access_log}}"
           }
        }
        else if [type] == "nginx-error" {
           elasticsearch {
              hosts => {{elk.logstash.logstash_to_es_hosts}}
              index => "{{elk.logstash.index.nginx_error_log}}"
           }
        }
        else if [type] == "tomcat-catalina" {
           elasticsearch {
              hosts => {{elk.logstash.logstash_to_es_hosts}}
              index => "{{elk.logstash.index.tomcat_log}}"
           }
        }
    }
    else if [app] == "k8s" {
        if [type] == "module" {
           elasticsearch {
              hosts => {{elk.logstash.logstash_to_es_hosts}}
              index => "{{elk.logstash.index.k8s_log}}"
           }
        }
    }
}
